<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="description" content="">
		<meta name="author" content="">

		<title>后台管理</title>
		<!-- Bootstrap core CSS -->
		<link th:href="@{/webjars/bootstrap/4.4.1-1/css/bootstrap.css}" rel="stylesheet">

		<link th:href="@{/asserts/css/dashboard.css}" rel="stylesheet">
		<link th:href="@{/iconfont/iconfont.css}" rel="stylesheet">
		<style type="text/css">

			@-webkit-keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			@keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}

		</style>
	</head>

	<body>
		<!--引入抽取的topbar-->
		<!--模板名：会使用thymeleaf的前后缀配置规则进行解析-->
		<div th:replace="commons/bar::topbar"></div>

		<div class="container-fluid">
			<div class="row">
				<!--引入侧边栏-->
				<div th:replace="commons/bar::#sidebar(activeUri='salaryaccounts')"></div>

				<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
					<!--需要区分是修改还是添加；-->
					<form th:action="@{/salaryaccount}" method="post">
						<input type="hidden" name="_method" value="put" th:if="${salaryaccount!=null}"/>
						<input type="hidden" name="id" th:if="${salaryaccount!=null}" th:value="${salaryaccount.id}">
						<div class="form-group">
							<label>套账名称</label>
							<input name="name" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.name}">
						</div>
						<div class="form-group">
							<label>基本工资</label>
							<<input name="basicSalary" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.basicSalary}">
						</div>
						<div class="form-group">
							<label>奖金</label>
							<<input name="bonus" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.bonus}">
						</div>
						<div class="form-group">
							<label>午餐补助</label>
							<<input name="lunchSalary" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.lunchSalary}">
						</div>
						<div class="form-group">
							<label>交通补助</label>
							<<input name="trafficSalary" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.trafficSalary}">
						</div>
						<div class="form-group">
							<label>应发工资</label>
							<<input name="allSalary" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.allSalary}">
						</div>
						<div class="form-group">
							<label>养老金基数</label>
							<<input name="pensionBase" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.pensionBase}">
						</div>
						<div class="form-group">
							<label>养老金比率</label>
							<<input name="pensionPer" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.pensionPer}">
						</div>
						<div class="form-group">
							<label>医疗基数</label>
							<<input name="medicalBase" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.medicalBase}">
						</div>
						<div class="form-group">
							<label>医疗保险比率</label>
							<<input name="medicalPer" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.medicalPer}">
						</div>
						<div class="form-group">
							<label>公积金基数</label>
							<<input name="accumulationFundBase" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.accumulationFundBase}">
						</div>
						<div class="form-group">
							<label>公积金比率</label>
							<<input name="accumulationFundPer" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${salaryaccount.accumulationFundPer}">
						</div>
						<div class="form-group">
							<label>审核状态</label>
							<select class="form-control" name="state">
								<option th:text="通过"></option>
								<option th:text="审查中"></option>
								<option th:text="废弃"></option>
								<option th:text="起草"></option>
							</select>
						</div>
						<div class="form-group">
							<label>更新时间</label>
							<<input name="updatetime" id="time" type="text" class="form-control" placeholder="" th:value="${salaryaccount!=null}?${#dates.format(salaryaccount.updatetime, 'yyyy-MM-dd')}">
							<script>
								Date.prototype.format = function (fmt) {
									var o = {
										"y+": this.getFullYear, //年
										"M+": this.getMonth() + 1, //月份
										"d+": this.getDate(), //日
									};
									if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
									for (var k in o)
										if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
									return fmt;
								}
								document.getElementById('time').value = (new Date()).format('yyyy-MM-dd');
							</script>
						</div>


						<button type="submit" class="btn btn-primary" th:text="${salaryaccount!=null}?'修改':'添加'">添加</button>
					</form>
				</main>
			</div>
		</div>

		<!-- Bootstrap core JavaScript
    ================================================== -->
		<!-- Placed at the end of the document so the pages load faster -->
		<script type="text/javascript" th:src="@{/webjars/jquery/3.5.0/jquery.js}"></script>
		<script type="text/javascript" th:src="@{/webjars/popper.js/1.14.3/dist/popper.js}"></script>
		<script type="text/javascript" th:src="@{/webjars/bootstrap/4.1.1-1/js/bootstrap.js}"></script>

	</body>

</html>